﻿using UnityEngine;
using DG.Tweening;

public class TankComeout : MonoBehaviour {

    public ParticleSystem comeoutEffect;
    public Transform effectTransition;

	void Start () {
        if (!comeoutEffect.gameObject.activeInHierarchy)
        {
            if (effectTransition == null)
            {
                comeoutEffect = Instantiate(comeoutEffect, transform.position, transform.rotation);
            }
            else
            {
                comeoutEffect = Instantiate(comeoutEffect, effectTransition.position, effectTransition.rotation);
            }
        }

        Destroy(comeoutEffect.gameObject, 1.5f);

        gameObject.SetActive(false);
        Invoke("Setup", 1f);

    }
	
	private void Setup()
    {
        gameObject.SetActive(true);
        gameObject.transform.DOScale(.2f, .5f).From();

    }
}
